package com.design.model;

import com.design.model.behavior.FlyWithWing;
import com.design.model.behavior.Quack;

/**
 * 动物鸭
 *
 * @author by liuxin
 * @version 0.1
 */
public class AnimalDuck extends Duck {

    /**
     * 构造方法，需要指定接口的实现类
     * 这种方式不太灵活，所有在超类中使用set/get方法动态修改实现类
     */
    public AnimalDuck() {
        flyBehavior = new FlyWithWing();
        quackBehavior = new Quack();
    }

    @Override
    public void swim() {
        System.out.println("====>鸭子在水中漂浮===");
    }

    @Override
    public void display() {
        System.out.println("我长得像个鸭子");
    }
}
